const { Controller } = require("egg");

class VodController extends Controller {
  async createUploadVideo() {
    const {
      ctx: {
        query,
        app: { vodClient },
      },
    } = this;

    this.ctx.validate(
      {
        Title: { type: "string" },
        FileName: { type: "string" },
      },
      query
    );

    this.ctx.body = await vodClient.request("CreateUploadVideo", query, {});
  }

  // 刷新上传视频状态
  async refreshUploadVideo() {
    const {
      ctx: { query },
      app: { vodClient },
    } = this;

    this.ctx.validate(
      {
        VideoId: { type: "string" },
      },
      query
    );

    this.ctx.body = await vodClient.request("RefreshUploadVideo", query, {});
  }
}

module.exports = VodController;
